package com.jiyang.jyandroid.test01;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.jiyang.jyandroid.BaseActivity;
import com.jiyang.jyandroid.R;

/**
 * Created by jy on 2016/10/17.
 * 图片浏览器
 */

public class One_3Activity extends BaseActivity {
    private int[] imagesId = new int[]{R.drawable.image01, R.drawable.image02, R.drawable.image03, R.drawable.image04};
    private ImageView iv;
    private int count = 0;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test01_3);
        iv = (ImageView) findViewById(R.id.iv);
        iv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                count++;
                if (count == imagesId.length) {
                    count = 0;
                }
                iv.setImageResource(imagesId[count]);
            }
        });
    }
}
